package com.lwm.service.impl;

import com.lwm.dao.IAccountDAO;
import com.lwm.factory.SingletonBeanFactory;
import com.lwm.service.IAccountService;

/**
 * @author liweimin
 * @date 2021/6/1 16:23
 * @since
 */
public class AccountServiceImpl implements IAccountService {

    private int i = 1;

    //    private IAccountDAO accountDAO = new AccountDAOImpl();

    /**
     * 使用工厂获取bean
     **/
//    private IAccountDAO accountDAO = (IAccountDAO) BeanFactory.getBean("accountDAO");

    //单例Bean
    private IAccountDAO accountDAO = (IAccountDAO) SingletonBeanFactory.getBean("accountDAO");

    @Override
    public void saveAccount() {
        accountDAO.saveAccount();
        System.out.println(i++);
    }
}
